package com.health.work.parse;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.health.work.model.AddressBean;
import com.health.work.utils.DefaultJSONData;

public class AddressParse implements DefaultJSONData {
	public ArrayList<AddressBean> addressList;
	public List<String> nameList;
	@Override
	public void parse(JSONArray array) throws JSONException {
		if(array!=null && array.length()>0){
			nameList= new ArrayList<String>(); 
			addressList=new ArrayList<AddressBean>();
			for(int i=0;i<array.length();i++){
				AddressBean bean=new AddressBean();
				bean.provinceId=array.getJSONObject(i).getString("id");
				bean.provinceName=array.getJSONObject(i).getString("name");
				System.out.println(bean.provinceName+" & id="+bean.provinceId);
				nameList.add(bean.provinceName);
				addressList.add(bean);
			}
		}
	}

	@Override
	public void parse(JSONObject object) throws JSONException {

	}

	@Override
	public void parse(String result) throws JSONException {
		
	}

}
